//package com.bjsxt.receive;
//
//import com.rabbitmq.client.Channel;
//import java.io.IOException;
//import org.springframework.amqp.core.Message;
//import org.springframework.amqp.rabbit.annotation.Exchange;
//import org.springframework.amqp.rabbit.annotation.Queue;
//import org.springframework.amqp.rabbit.annotation.QueueBinding;
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
//import org.springframework.stereotype.Component;
//
///**
// * Created with IntelliJ IDEA.
// *
// * @Auther: 雷哥
// * @Date: 2020/10/11/14:49
// * @Description:
// */
//@Component
//public class MessageReceive1 {
//  @RabbitListener(bindings = {
//      @QueueBinding(value = @Queue("queue"),
//      key = "error",
//      exchange = @Exchange(value = "directs"))//默认的直连交换机
//  })
//  public void receiveMessage(String content, Message message, Channel channel) throws IOException {
//    System.out.println("消费者收到消息-内容为:"+content);
//    System.out.println("消费者收到消息-消息对象:"+message);
//    System.out.println("消费者收到消息-信道:"+channel);
//    long deliveryTag = message.getMessageProperties().getDeliveryTag();//消息投递ID
//    System.out.println("消息投递ID:"+deliveryTag);
//    String messageId = message.getMessageProperties().getMessageId();
//    System.out.println("消息自定义ID:"+messageId);
//    /**
//     * 参数说明:
//     * deliveryTag  消息投递ID，要签收的投递ID是多少
//     * multiple:是否批量签收
//     */
//    channel.basicAck(deliveryTag,false);
//    System.out.println("消息签收成功");
//    System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
//  }
//
//}
